/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.db.CustomerManager;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.net.URLEncoder;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ 
/*    */ public class MergeCustomer extends AbstractAction
/*    */ {
/* 18 */   private int oldId = 0;
/* 19 */   private int newId = 0;
/* 20 */   private boolean isPerson = false;
/*    */ 
/*    */   public MergeCustomer(AbstractHttpServlet servlet) {
/* 23 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public MergeCustomer(AbstractHttpServlet servlet, int oldId, int newId, boolean isPerson)
/*    */   {
/* 28 */     super(servlet);
/* 29 */     this.oldId = oldId;
/* 30 */     this.newId = newId;
/* 31 */     this.isPerson = isPerson;
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 37 */     CustomerManager manager = new CustomerManager();
/* 38 */     manager.mergeCustomer(this.oldId, this.newId, this.isPerson);
/*    */ 
/* 40 */     String oldName = Util.getURLParameter(request.getParameter("oldName"));
/* 41 */     StringBuffer url = new StringBuffer(request.getContextPath());
/* 42 */     url.append(this.isPerson ? "/people/" : "/company/").append(this.newId);
/*    */ 
/* 45 */     url.append("?merge=1&oldName=").append(
/* 46 */       URLEncoder.encode(oldName, "UTF-8"));
/* 47 */     response.sendRedirect(url.toString());
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.MergeCustomer
 * JD-Core Version:    0.6.1
 */